package com.rbac.utils;


import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;

import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;

public class SecureKeyGenerator {

    public static void main(String[] args) throws NoSuchAlgorithmException {
        // 自动生成HS512算法所需的安全密钥
        SecretKey key = Keys.secretKeyFor(SignatureAlgorithm.HS512);
        // 如果需要持久化，可以转换为Base64字符串
        String base64Key = java.util.Base64.getEncoder().encodeToString(key.getEncoded());
        System.out.println("Generated key: " + base64Key);
    }
}
